<?php
namespace app\index\controller;
use think\Controller;

class Interfaces extends controller{
    function reply($status,$content){
        // 提交客服请求
    	if(!$status||!$content)return 0;
        $result['status'] = $status;
    	$result['content'] = $content;
    	$result['user_id'] = session('userid');
    	$result['times'] = time();
    	model('kefu')->insert($result);
    	return 1;
     }
     function passchange($password,$p1){
        $result = model('user')->findusername(session('userid'),$password);
        if($result){
            model('user')->where('id',$result["id"])->update(["password"=>$p1]);
            echo "success";
            exit();
        }
        echo "false";
        exit();
     }
     function removesingle(){
        session('buy',null);
        return 'success';
     }
     function text(){
        mp(session("buy"));
     }
     function ckfrom($stime,$etime){
        // 将时间格式转换成时间戳
        $stime =strtotime($stime);
        $etime =strtotime($etime);
        if($etime>time())return 1;
        // 找到用户的信息
        $res = model("ordered")->findID(session("userid"),$stime,$etime);
        mp($res);
        // echo $stime."+".$etime;
        // exit();
        
     }
}